package com.demo.token;


import com.demo.AppletConstant;
import com.demo.util.Utils;

import java.util.HashMap;
import java.util.Map;


/**
 * 获取accessToken和openId
 *
 */
public class AccessTokenAndOpenId {
	public static void main(String[] args) {

		//调用地址
		String url = "https://open.95516.com/open/access/1.0/token";

		//拼装参数Map
		Map<String, String> params = new HashMap<String, String>(0);
		params.put("appId", AppletConstant.APP_ID);
		params.put("backendToken", AppletConstant.backendToken);
		
		//登录获取的code
		params.put("code", AppletConstant.code);

		//接入方直接填写常量字符串authorization_code
		params.put("grantType", "authorization_code");

		//发送请求
		String resultStr = Utils.sendPostGson(url, params);
		System.out.println("-------获取accessToken和openId:"+resultStr+"---------");
	}
	
}
